 <!-- 报案信息录入 报案入口  -->
<template>
    <div>
        <el-card class="box-card">
            <div slot="header" class="card-heaer">
                <span style="line-height: 36px;">订单查询</span>
    
            </div>
            <el-card class="box-card">
                <div slot="header" class="card-heaer">
                    <span style="line-height: 36px;">下面三项，任选一项进行查询</span>
                </div>
                <el-form :inline="true" :model="searchitem" class="demo-form-inline">
                    <el-form-item label="被保人姓名:">
                        <el-input v-model.trim="searchitem.name" placeholder="被保人姓名"></el-input>
                    </el-form-item>
                  
                    <el-form-item label="被保险人护照号:">
                        <el-input v-model.trim="searchitem.passport" placeholder="被保险人护照号"></el-input>
                    </el-form-item>
                    <el-form-item label="保险单号:">
                        <el-input v-model.trim="searchitem.number" placeholder="保险单号"></el-input>
    
                    </el-form-item>
                    <el-button type="primary" @click="onSubmit">查询</el-button>
                </el-form>
            </el-card>
            <div class="space20">
            </div>
            <el-card class="box-card" v-if="searchresult!=''">
                <div slot="header" class="card-heaer">
                    <span style="line-height: 36px;">查询结果</span>
                </div>
    
                <reportOrder :searchresult="searchresult">
                </reportOrder>
    
            </el-card>        
          
        </el-card>
    
    </div>
</template>
<script>
import reportOrder from '@/components/search/list';
export default {
    data() {
        return {
            search: true,
            searchitem: {
                name: "",
                birthday: "",
                passport: "",
                number: ""
            },
            searchresult: [],
            history: {}

        }
    },
    components: {
        'reportOrder': reportOrder
      
    },
    methods: {
        onSubmit() {
            if (!(this.searchitem.name != "" || this.searchitem.number != "" || this.searchitem.passport != "" ))
               { this.$notify.error({
                    title: '输入错误',
                    message: '至少选择一项进行查询'
                });
                return;
            } 
            // this.$store.commit('showloding', true);
            var BirthDay = "";
            if (this.searchitem.birthday != "") {
                var date = new Date(this.searchitem.birthday);
                BirthDay = date.getFullYear() + '/' + (date.getMonth() + 1) + '/' + date.getDate()
            }

            var json = {
                "Name": this.searchitem.name,               
                "PassportNumber": this.searchitem.passport,
                "PolicyNumber": this.searchitem.number
            }
            this.$http.post("OrderList/getlist", json).then(response => {
                var data = response.body;
                // this.$store.commit('showloding', false);
                if (data.code == 1) {
                    var str = JSON.stringify(data.result);
                    sessionStorage.setItem("ReportUser", str);
                    this.searchresult = data.result;
                 
                    // sessionStorage.setItem("Role")= data.result.UserType;
                } else {
                    this.loding = false;
                    this.$notify.error({
                        title: '查询失败',
                        message: '查询失败'
                    });
                }
            }, response => {
                // this.$store.commit('showloding', false);
                this.$notify.error({
                    title: '查询失败',
                    message: '网络错误'
                });
                this.loding = false;
            });
            this.$http.post("OrderList/gethistory", json).then(response => {
                var data = response.body;

                if (data.code == 1) {
                    this.history = data;
                    // sessionStorage.setItem("Role")= data.result.UserType;
                } else {
                    this.loding = false;
                    this.$notify.error({
                        title: '查询失败',
                        message:'查询失败'
                    });
                }
            }, response => {
                this.$notify.error({
                    title: '查询失败',
                    message: '网络错误'
                });

            });
        }

    }
}
</script>